<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>组织架构管理 - Kexio 管理系统</title>
  <!-- 引入Element Plus CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-plus@2.4.4/dist/index.css">
  <!-- 引入Font Awesome图标 -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <!-- 引入Tailwind CSS -->
  <script src="https://cdn.tailwindcss.com"></script>
  
  <!-- 配置Tailwind CSS自定义颜色和字体 -->
  <script>
    tailwind.config = {
      theme: {
        extend: {
          colors: {
            primary: '#000000',
            'primary-hover': '#333333',
            'primary-active': '#222222',
            'primary-weak': 'rgba(0, 0, 0, .05)',
            'text-primary': '#333333',
            'text-secondary': '#666666',
            'text-muted': '#999999',
            'bg-page': '#f5f5f5',
            'bg-panel': '#ffffff',
            'bg-hover': '#eeeeee',
            'border': '#dddddd',
            success: '#22c55e',
            warning: '#f59e0b',
            danger: '#ef4444',
            info: '#3b82f6'
          },
          fontFamily: {
            sans: ['Inter', 'system-ui', 'sans-serif']
          },
          boxShadow: {
            'card': '0 8px 16px rgba(15, 23, 42, .06)',
            'hover': '0 12px 24px rgba(15, 23, 42, .12)',
            'sm': '0 2px 6px rgba(15, 23, 42, .05)',
            'md': '0 6px 12px rgba(15, 23, 42, .08)',
            'lg': '0 10px 20px rgba(15, 23, 42, .10)'
          },
          borderRadius: {
            'sm': '8px',
            'md': '12px',
            'lg': '16px',
            'xl': '20px'
          }
        }
      }
    }
  </script>
  
  <!-- 自定义工具类 -->
  <style type="text/tailwindcss">
    @layer utilities {
      .content-auto {
        content-visibility: auto;
      }
      .menu-item-active {
        @apply bg-primary-weak text-primary border-r-4 border-primary;
      }
      .transition-sidebar {
        @apply transition-all duration-300 ease-in-out;
      }
      .scrollbar-hide::-webkit-scrollbar {
        display: none;
      }
      .scrollbar-hide {
        -ms-overflow-style: none;
        scrollbar-width: none;
      }
      .org-tree-line {
        @apply absolute left-3 top-0 bottom-0 w-px bg-border;
      }
      .org-tree-item-active {
        @apply bg-primary-weak text-primary rounded-md;
      }
    }
  </style>
  
  <style>
    /* 全局样式重置 */
    body {
      margin: 0;
      padding: 0;
      font-family: 'Inter', system-ui, sans-serif;
      background-color: #f5f5f5;
      color: #333333;
    }
    
    /* 侧边栏样式 */
    .sidebar {
      height: 100vh;
      background-color: white;
      box-shadow: 0 2px 6px rgba(15, 23, 42, .05);
      z-index: 900;
    }
    
    .menu-item {
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .menu-item:hover {
      background-color: #f1f5f9;
    }
    
    /* 顶部导航样式 */
    .navbar {
      height: 60px;
      background-color: white;
      box-shadow: 0 2px 6px rgba(15, 23, 42, .05);
      z-index: 1000;
    }
    
    /* 面包屑样式 */
    .breadcrumb-item {
      color: #94a3b8;
    }
    
    .breadcrumb-item.active {
      color: #000000;
    }
    
    /* 卡片样式 */
    .card-hover {
      transition: all 0.3s ease;
    }
    
    .card-hover:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 24px rgba(15, 23, 42, .12);
    }
    
    /* 表格样式 */
    .table-row:hover {
      background-color: #f1f5f9;
    }
    
    /* 组织树样式 */
    .org-tree {
      list-style: none;
      padding-left: 0;
    }
    
    .org-tree .tree-item {
      margin: 2px 0;
      padding: 4px 0;
      cursor: pointer;
      position: relative;
    }
    
    .org-tree .tree-content {
      padding: 6px 12px 6px 24px;
      transition: all 0.2s ease;
      position: relative;
      z-index: 1;
    }
    
    .org-tree .tree-content:hover {
      background-color: #f1f5f9;
      border-radius: 4px;
    }
    
    .org-tree .tree-children {
      list-style: none;
      padding-left: 24px;
      position: relative;
    }
    
    .org-tree .tree-children:before {
      content: '';
      position: absolute;
      left: 6px;
      top: 18px;
      bottom: 0;
      width: 0;
      border-left: 1px dashed #e2e8f0;
    }
    
    .org-tree .tree-expand {
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 10px;
      color: #94a3b8;
    }
    
    /* 加载动画 */
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    
    .animate-fadeIn {
      animation: fadeIn 0.3s ease-out;
    }
    
    /* 响应式设计 */
    @media (max-width: 768px) {
      .sidebar {
        transform: translateX(-100%);
        position: fixed;
      }
      
      .sidebar.open {
        transform: translateX(0);
      }
      
      .main-content {
        margin-left: 0 !important;
      }
    }
  </style>
</head>
<body class="bg-bg-page">
  <div class="flex h-screen overflow-hidden">
    <!-- 侧边栏 -->
    <aside id="sidebar" class="sidebar w-60 fixed left-0 top-0 bottom-0 transition-sidebar">
      <!-- Logo区域 -->
      <div class="flex items-center justify-center h-16 border-b border-border">
        <div class="text-primary font-bold text-xl flex items-center">
          <i class="fas fa-cube mr-2"></i>
          <span>Kexio</span>
        </div>
      </div>
      
      <!-- 菜单区域 -->
      <nav class="h-[calc(100vh-100px)] overflow-y-auto scrollbar-hide p-4">
        <div class="mb-4 text-xs text-text-muted uppercase font-semibold pl-2">主导航</div>
        
        <!-- 菜单项 -->
        <div class="space-y-1">
          <a href="index.html" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-tachometer-alt w-5 text-center mr-3"></i>
            <span>仪表盘</span>
          </a>
          
          <a href="user-management.html" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-users w-5 text-center mr-3"></i>
            <span>用户管理</span>
          </a>
          
          <a href="role-management.html" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-user-shield w-5 text-center mr-3"></i>
            <span>角色权限</span>
          </a>
          
          <a href="org-management.html" class="flex items-center px-4 py-3 rounded-md menu-item-active">
            <i class="fas fa-sitemap w-5 text-center mr-3"></i>
            <span>组织架构</span>
          </a>
          
          <a href="#" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-file-alt w-5 text-center mr-3"></i>
            <span>文件管理</span>
          </a>
          
          <a href="#" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-cog w-5 text-center mr-3"></i>
            <span>系统设置</span>
          </a>
        </div>
        
        <div class="my-6 border-t border-border"></div>
        
        <div class="mb-4 text-xs text-text-muted uppercase font-semibold pl-2">扩展功能</div>
        
        <div class="space-y-1">
          <a href="#" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-chart-line w-5 text-center mr-3"></i>
            <span>数据分析</span>
          </a>
          
          <a href="#" class="flex items-center px-4 py-3 rounded-md text-text-secondary menu-item">
            <i class="fas fa-bell w-5 text-center mr-3"></i>
            <span>消息中心</span>
            <span class="ml-auto bg-danger text-white text-xs px-2 py-0.5 rounded-full">3</span>
          </a>
        </div>
      </nav>
      
      <!-- 用户信息区域 -->
      <div class="absolute bottom-0 left-0 right-0 p-4 border-t border-border bg-white">
        <div class="flex items-center">
          <img src="https://picsum.photos/id/1005/40/40" alt="用户头像" class="w-10 h-10 rounded-full object-cover border-2 border-primary-weak">
          <div class="ml-3">
            <div class="text-text-primary font-medium">管理员</div>
            <div class="text-text-muted text-xs">超级管理员</div>
          </div>
          <button class="ml-auto text-text-muted hover:text-text-primary">
            <i class="fas fa-sign-out-alt"></i>
          </button>
        </div>
      </div>
    </aside>
    
    <!-- 主内容区域 -->
    <div id="main-content" class="flex-1 flex flex-col main-content ml-60 transition-sidebar">
      <!-- 顶部导航栏 -->
      <header class="navbar flex items-center justify-between px-6">
        <!-- 左侧按钮区域 -->
        <div class="flex items-center">
          <button id="sidebar-toggle" class="lg:hidden mr-4 text-text-secondary hover:text-primary">
            <i class="fas fa-bars text-xl"></i>
          </button>
          
          <!-- 面包屑导航 -->
          <nav class="hidden md:flex items-center space-x-2 text-sm">
            <a href="index.html" class="breadcrumb-item">首页</a>
            <i class="fas fa-chevron-right text-xs text-text-muted"></i>
            <span class="breadcrumb-item active">组织架构管理</span>
          </nav>
        </div>
        
        <!-- 右侧操作区域 -->
        <div class="flex items-center space-x-4">
          <!-- 搜索框 -->
          <div class="relative hidden md:block">
            <input type="text" placeholder="搜索..." class="pl-9 pr-4 py-2 rounded-md border border-border bg-bg-hover focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary w-60">
            <i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-text-muted"></i>
          </div>
          
          <!-- 消息通知 -->
          <button class="relative p-2 text-text-secondary hover:text-primary hover:bg-bg-hover rounded-full">
            <i class="fas fa-bell text-lg"></i>
            <span class="absolute top-0 right-0 w-2 h-2 bg-danger rounded-full"></span>
          </button>
          
          <!-- 帮助中心 -->
          <button class="p-2 text-text-secondary hover:text-primary hover:bg-bg-hover rounded-full">
            <i class="fas fa-question-circle text-lg"></i>
          </button>
          
          <!-- 主题切换 -->
          <button class="p-2 text-text-secondary hover:text-primary hover:bg-bg-hover rounded-full">
            <i class="fas fa-moon text-lg"></i>
          </button>
        </div>
      </header>
      
      <!-- 内容区域 -->
      <main class="flex-1 overflow-y-auto p-6">
        <!-- 页面标题和操作按钮 -->
        <div class="flex flex-col md:flex-row md:items-center md:justify-between mb-6">
          <div>
            <h1 class="text-2xl font-bold text-text-primary">组织架构管理</h1>
            <p class="text-text-muted mt-2">查看和管理公司的组织架构、部门信息及成员</p>
          </div>
          <div class="mt-4 md:mt-0 flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-3">
            <button id="import-org-btn" class="bg-white hover:bg-bg-hover text-text-secondary border border-border px-6 py-2 rounded-md flex items-center justify-center shadow-sm transition-all">
              <i class="fas fa-file-import mr-2"></i>
              <span>导入部门</span>
            </button>
            <button id="export-org-btn" class="bg-white hover:bg-bg-hover text-text-secondary border border-border px-6 py-2 rounded-md flex items-center justify-center shadow-sm transition-all">
              <i class="fas fa-file-export mr-2"></i>
              <span>导出部门</span>
            </button>
            <button id="add-dept-btn" class="bg-primary hover:bg-primary-hover text-white px-6 py-2 rounded-md flex items-center justify-center shadow-card transition-all">
              <i class="fas fa-plus mr-2"></i>
              <span>新增部门</span>
            </button>
          </div>
        </div>
        
        <!-- 组织架构图和部门详情区域 -->
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
          <!-- 组织架构树 -->
          <div class="lg:col-span-1">
            <div class="bg-white rounded-lg shadow-card overflow-hidden">
              <!-- 组织架构树头部 -->
              <div class="p-4 border-b border-border bg-bg-hover flex justify-between items-center">
                <div class="text-text-secondary font-medium">组织架构</div>
                <div class="flex space-x-2">
                  <button id="expand-all-tree-btn" class="p-1 text-text-muted hover:text-primary" title="展开全部">
                    <i class="fas fa-chevron-down"></i>
                  </button>
                  <button id="collapse-all-tree-btn" class="p-1 text-text-muted hover:text-primary" title="收起全部">
                    <i class="fas fa-chevron-right"></i>
                  </button>
                </div>
              </div>
              
              <!-- 组织架构树内容 -->
              <div class="p-4 max-h-[calc(100vh-280px)] overflow-y-auto">
                <ul class="org-tree">
                  <!-- 公司总部 -->
                  <li class="tree-item" data-id="company">
                    <div class="tree-content org-tree-item-active">
                      <div class="flex items-center">
                        <div class="tree-expand" data-target="company-children">
                          <i class="fas fa-chevron-down"></i>
                        </div>
                        <div class="flex items-center">
                          <i class="fas fa-building text-primary mr-2"></i>
                          <span class="font-medium">Kexio科技有限公司</span>
                        </div>
                      </div>
                    </div>
                    <ul class="tree-children" id="company-children" style="display: block;">
                      <!-- 技术部 -->
                      <li class="tree-item" data-id="tech">
                        <div class="tree-content">
                          <div class="flex items-center">
                            <div class="tree-expand" data-target="tech-children">
                              <i class="fas fa-chevron-down"></i>
                            </div>
                            <div class="flex items-center">
                              <i class="fas fa-laptop-code text-info mr-2"></i>
                              <span>技术部</span>
                            </div>
                          </div>
                        </div>
                        <ul class="tree-children" id="tech-children" style="display: block;">
                          <li class="tree-item" data-id="frontend">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-code text-info mr-2"></i>
                                <span>前端开发组</span>
                              </div>
                            </div>
                          </li>
                          <li class="tree-item" data-id="backend">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-server text-info mr-2"></i>
                                <span>后端开发组</span>
                              </div>
                            </div>
                          </li>
                          <li class="tree-item" data-id="test">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-vial text-info mr-2"></i>
                                <span>测试组</span>
                              </div>
                            </div>
                          </li>
                          <li class="tree-item" data-id="ui">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-paint-brush text-info mr-2"></i>
                                <span>UI设计组</span>
                              </div>
                            </div>
                          </li>
                        </ul>
                      </li>
                      
                      <!-- 市场部 -->
                      <li class="tree-item" data-id="marketing">
                        <div class="tree-content">
                          <div class="flex items-center">
                            <div class="tree-expand" data-target="marketing-children">
                              <i class="fas fa-chevron-down"></i>
                            </div>
                            <div class="flex items-center">
                              <i class="fas fa-bullhorn text-warning mr-2"></i>
                              <span>市场部</span>
                            </div>
                          </div>
                        </div>
                        <ul class="tree-children" id="marketing-children" style="display: block;">
                          <li class="tree-item" data-id="product">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-cube text-warning mr-2"></i>
                                <span>产品组</span>
                              </div>
                            </div>
                          </li>
                          <li class="tree-item" data-id="operation">
                            <div class="tree-content">
                              <div class="flex items-center">
                                <i class="fas fa-tasks text-warning mr-2"></i>
                                <span>运营组</span>
                              </div>
                            </div>
                          </li>
                        </ul>
                      </li>
                      
                      <!-- 财务部 -->
                      <li class="tree-item" data-id="finance">
                        <div class="tree-content">
                          <div class="flex items-center">
                            <i class="fas fa-chart-pie text-success mr-2"></i>
                            <span>财务部</span>
                          </div>
                        </div>
                      </li>
                      
                      <!-- 人力资源部 -->
                      <li class="tree-item" data-id="hr">
                        <div class="tree-content">
                          <div class="flex items-center">
                            <i class="fas fa-user-tie text-danger mr-2"></i>
                            <span>人力资源部</span>
                          </div>
                        </div>
                      </li>
                      
                      <!-- 销售部 -->
                      <li class="tree-item" data-id="sales">
                        <div class="tree-content">
                          <div class="flex items-center">
                            <i class="fas fa-shopping-cart text-info mr-2"></i>
                            <span>销售部</span>
                          </div>
                        </div>
                      </li>
                    </ul>
                  </li>
                </ul>
              </div>
              
              <!-- 组织架构统计信息 -->
              <div class="p-4 border-t border-border bg-bg-hover text-sm">
                <div class="text-text-secondary">
                  共 <span class="text-primary font-medium">11</span> 个部门，
                  <span class="text-primary font-medium">32</span> 名成员
                </div>
              </div>
            </div>
          </div>
          
          <!-- 部门详情和成员列表 -->
          <div class="lg:col-span-2">
            <!-- 部门详情卡片 -->
            <div class="bg-white rounded-lg shadow-card overflow-hidden mb-6">
              <!-- 部门详情头部 -->
              <div class="p-4 border-b border-border bg-bg-hover">
                <div class="text-text-secondary font-medium">部门详情</div>
              </div>
              
              <!-- 部门详情内容 -->
              <div class="p-6">
                <div class="flex flex-col md:flex-row items-start md:items-center mb-6">
                  <div class="w-16 h-16 rounded-full bg-primary-weak flex items-center justify-center mr-4 mb-4 md:mb-0">
                    <i class="fas fa-building text-2xl text-primary"></i>
                  </div>
                  <div>
                    <h3 class="text-xl font-bold text-text-primary">Kexio科技有限公司</h3>
                    <p class="text-text-muted mt-1">公司总部</p>
                  </div>
                  <div class="ml-auto flex space-x-2">
                    <button id="edit-dept-btn" class="px-4 py-1.5 border border-border rounded-md text-text-secondary hover:bg-bg-hover text-sm">
                      <i class="fas fa-edit mr-1"></i> 编辑
                    </button>
                    <button id="delete-dept-btn" class="px-4 py-1.5 border border-danger rounded-md text-danger hover:bg-danger/10 text-sm">
                      <i class="fas fa-trash mr-1"></i> 删除
                    </button>
                  </div>
                </div>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                  <!-- 基本信息 -->
                  <div>
                    <h4 class="text-text-secondary font-medium mb-4">基本信息</h4>
                    <div class="space-y-3">
                      <div class="flex">
                        <div class="w-24 text-text-muted">部门负责人:</div>
                        <div class="text-text-primary">张三</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">成立时间:</div>
                        <div class="text-text-primary">2020-01-01</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">部门级别:</div>
                        <div class="text-text-primary">一级部门</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">所属公司:</div>
                        <div class="text-text-primary">Kexio科技有限公司</div>
                      </div>
                    </div>
                  </div>
                  
                  <!-- 人员信息 -->
                  <div>
                    <h4 class="text-text-secondary font-medium mb-4">人员信息</h4>
                    <div class="space-y-3">
                      <div class="flex">
                        <div class="w-24 text-text-muted">成员总数:</div>
                        <div class="text-text-primary">32人</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">管理人员:</div>
                        <div class="text-text-primary">5人</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">在职状态:</div>
                        <div class="text-text-primary">全部在职</div>
                      </div>
                      <div class="flex">
                        <div class="w-24 text-text-muted">部门状态:</div>
                        <div class="text-text-primary">正常</div>
                      </div>
                    </div>
                  </div>
                </div>
                
                <!-- 部门描述 -->
                <div class="mt-6">
                  <h4 class="text-text-secondary font-medium mb-3">部门描述</h4>
                  <div class="p-4 bg-bg-hover rounded-md text-text-secondary">
                    Kexio科技有限公司是一家专注于企业级软件开发的高新技术企业，致力于为客户提供优质的软件产品和服务。公司拥有一支专业、高效的团队，秉承"创新、协作、共赢"的企业理念，不断提升产品质量和服务水平，为客户创造更大的价值。
                  </div>
                </div>
              </div>
            </div>
            
            <!-- 部门成员列表 -->
            <div class="bg-white rounded-lg shadow-card overflow-hidden">
              <!-- 部门成员列表头部 -->
              <div class="p-4 border-b border-border bg-bg-hover flex justify-between items-center">
                <div class="text-text-secondary font-medium">部门成员</div>
                <div class="flex items-center space-x-3">
                  <button id="add-member-btn" class="px-4 py-1.5 bg-primary text-white rounded-md hover:bg-primary-hover text-sm">
                    <i class="fas fa-plus mr-1"></i> 添加成员
                  </button>
                  <button id="batch-move-btn" class="px-4 py-1.5 border border-border rounded-md text-text-secondary hover:bg-bg-hover text-sm">
                    <i class="fas fa-exchange-alt mr-1"></i> 批量转移
                  </button>
                </div>
              </div>
              
              <!-- 部门成员列表内容 -->
              <div class="max-h-[calc(100vh-480px)] overflow-y-auto">
                <!-- 搜索和筛选 -->
                <div class="p-4 border-b border-border">
                  <div class="relative">
                    <input type="text" placeholder="搜索成员..." class="pl-9 pr-4 py-2 w-full rounded-md border border-border bg-bg-hover focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary">
                    <i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-text-muted"></i>
                  </div>
                </div>
                
                <!-- 成员列表 -->
                <div class="divide-y divide-border">
                  <!-- 成员1 -->
                  <div class="p-4 flex items-center justify-between animate-fadeIn">
                    <div class="flex items-center">
                      <img src="https://picsum.photos/id/1005/48/48" alt="用户头像" class="w-10 h-10 rounded-full mr-3">
                      <div>
                        <div class="font-medium text-text-primary">张三</div>
                        <div class="text-text-muted text-sm">董事长 / 超级管理员</div>
                      </div>
                    </div>
                    <div class="flex items-center space-x-3">
                      <div class="text-text-muted text-sm">2020-01-01加入</div>
                      <button class="text-text-muted hover:text-primary" title="查看详情">
                        <i class="fas fa-eye"></i>
                      </button>
                      <button class="text-text-muted hover:text-primary" title="转移部门">
                        <i class="fas fa-exchange-alt"></i>
                      </button>
                    </div>
                  </div>
                  
                  <!-- 成员2 -->
                  <div class="p-4 flex items-center justify-between animate-fadeIn" style="animation-delay: 0.1s">
                    <div class="flex items-center">
                      <img src="https://picsum.photos/id/1012/48/48" alt="用户头像" class="w-10 h-10 rounded-full mr-3">
                      <div>
                        <div class="font-medium text-text-primary">李四</div>
                        <div class="text-text-muted text-sm">总经理 / 管理员</div>
                      </div>
                    </div>
                    <div class="flex items-center space-x-3">
                      <div class="text-text-muted text-sm">2020-01-15加入</div>
                      <button class="text-text-muted hover:text-primary" title="查看详情">
                        <i class="fas fa-eye"></i>
                      </button>
                      <button class="text-text-muted hover:text-primary" title="转移部门">
                        <i class="fas fa-exchange-alt"></i>
                      </button>
                    </div>
                  </div>
                  
                  <!-- 成员3 -->
                  <div class="p-4 flex items-center justify-between animate-fadeIn" style="animation-delay: 0.2s">
                    <div class="flex items-center">
                      <img src="https://picsum.photos/id/1025/48/48" alt="用户头像" class="w-10 h-10 rounded-full mr-3">
                      <div>
                        <div class="font-medium text-text-primary">王五</div>
                        <div class="text-text-muted text-sm">财务总监 / 管理员</div>
                      </div>
                    </div>
                    <div class="flex items-center space-x-3">
                      <div class="text-text-muted text-sm">2020-02-01加入</div>
                      <button class="text-text-muted hover:text-primary" title="查看详情">
                        <i class="fas fa-eye"></i>
                      </button>
                      <button class="text-text-muted hover:text-primary" title="转移部门">
                        <i class="fas fa-exchange-alt"></i>
                      </button>
                    </div>
                  </div>
                  
                  <!-- 成员4 -->
                  <div class="p-4 flex items-center justify-between animate-fadeIn" style="animation-delay: 0.3s">
                    <div class="flex items-center">
                      <img src="https://picsum.photos/id/1027/48/48" alt="用户头像" class="w-10 h-10 rounded-full mr-3">
                      <div>
                        <div class="font-medium text-text-primary">赵六</div>
                        <div class="text-text-muted text-sm">技术总监 / 管理员</div>
                      </div>
                    </div>
                    <div class="flex items-center space-x-3">
                      <div class="text-text-muted text-sm">2020-02-15加入</div>
                      <button class="text-text-muted hover:text-primary" title="查看详情">
                        <i class="fas fa-eye"></i>
                      </button>
                      <button class="text-text-muted hover:text-primary" title="转移部门">
                        <i class="fas fa-exchange-alt"></i>
                      </button>
                    </div>
                  </div>
                </div>
              </div>
              
              <!-- 分页 -->
              <div class="p-4 border-t border-border flex justify-between items-center">
                <div class="text-text-secondary text-sm">
                  共 <span class="text-primary font-medium">32</span> 条数据，当前显示第 <span class="text-primary font-medium">1-4</span> 条
                </div>
                <div class="flex items-center space-x-2">
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover disabled:opacity-50 disabled:cursor-not-allowed" disabled>
                    <i class="fas fa-angle-left"></i>
                  </button>
                  <button class="w-8 h-8 flex items-center justify-center rounded bg-primary text-white">1</button>
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover">2</button>
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover">3</button>
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover">4</button>
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover">5</button>
                  <button class="w-8 h-8 flex items-center justify-center rounded border border-border text-text-secondary hover:bg-bg-hover">
                    <i class="fas fa-angle-right"></i>
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>
  
  <!-- 新增部门弹窗 -->
  <div id="add-dept-modal" class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 hidden">
    <div class="bg-white rounded-lg shadow-lg w-full max-w-lg max-h-[90vh] overflow-hidden flex flex-col animate-fadeIn">
      <!-- 弹窗头部 -->
      <div class="p-6 border-b border-border flex justify-between items-center">
        <h3 class="text-lg font-semibold text-text-primary">新增部门</h3>
        <button id="close-dept-modal-btn" class="text-text-muted hover:text-text-primary">
          <i class="fas fa-times"></i>
        </button>
      </div>
      
      <!-- 弹窗内容 -->
      <div class="p-6 overflow-y-auto flex-1">
        <form id="add-dept-form">
          <!-- 上级部门 -->
          <div class="mb-6">
            <label class="block text-text-secondary mb-2 text-sm font-medium">上级部门</label>
            <div class="relative">
              <select class="w-full px-4 py-2 rounded-md border border-border focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary appearance-none">
                <option value="company">Kexio科技有限公司</option>
                <option value="tech">技术部</option>
                <option value="marketing">市场部</option>
                <option value="finance">财务部</option>
                <option value="hr">人力资源部</option>
                <option value="sales">销售部</option>
              </select>
              <i class="fas fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2 text-text-muted pointer-events-none"></i>
            </div>
          </div>
          
          <!-- 部门名称 -->
          <div class="mb-6">
            <label class="block text-text-secondary mb-2 text-sm font-medium">部门名称 <span class="text-danger">*</span></label>
            <input type="text" class="w-full px-4 py-2 rounded-md border border-border focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" placeholder="请输入部门名称">
          </div>
          
          <!-- 部门负责人 -->
          <div class="mb-6">
            <label class="block text-text-secondary mb-2 text-sm font-medium">部门负责人</label>
            <div class="relative">
              <select class="w-full px-4 py-2 rounded-md border border-border focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary appearance-none">
                <option value="">无</option>
                <option value="1">张三</option>
                <option value="2">李四</option>
                <option value="3">王五</option>
                <option value="4">赵六</option>
              </select>
              <i class="fas fa-chevron-down absolute right-3 top-1/2 transform -translate-y-1/2 text-text-muted pointer-events-none"></i>
            </div>
          </div>
          
          <!-- 部门描述 -->
          <div class="mb-6">
            <label class="block text-text-secondary mb-2 text-sm font-medium">部门描述</label>
            <textarea class="w-full px-4 py-2 rounded-md border border-border focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" rows="3" placeholder="请输入部门描述信息"></textarea>
          </div>
          
          <!-- 部门状态 -->
          <div class="mb-6">
            <label class="block text-text-secondary mb-2 text-sm font-medium">部门状态 <span class="text-danger">*</span></label>
            <div class="flex items-center space-x-4">
              <label class="inline-flex items-center">
                <input type="radio" name="dept-status" value="active" class="text-primary focus:ring-primary" checked>
                <span class="ml-2 text-text-secondary">正常</span>
              </label>
              <label class="inline-flex items-center">
                <input type="radio" name="dept-status" value="disabled" class="text-primary focus:ring-primary">
                <span class="ml-2 text-text-secondary">禁用</span>
              </label>
            </div>
          </div>
        </form>
      </div>
      
      <!-- 弹窗底部 -->
      <div class="p-6 border-t border-border flex justify-end space-x-4">
        <button id="cancel-dept-btn" class="px-6 py-2 border border-border rounded-md text-text-secondary hover:bg-bg-hover">取消</button>
        <button id="submit-dept-btn" class="px-6 py-2 bg-primary text-white rounded-md hover:bg-primary-hover shadow-sm">确定</button>
      </div>
    </div>
  </div>
  
  <!-- 页面交互脚本 -->
  <script>
    // 侧边栏切换
    document.getElementById('sidebar-toggle').addEventListener('click', function() {
      const sidebar = document.getElementById('sidebar');
      sidebar.classList.toggle('open');
    });
    
    // 组织树展开/收起功能
    document.querySelectorAll('.tree-expand').forEach(expand => {
      expand.addEventListener('click', function(e) {
        e.stopPropagation(); // 阻止事件冒泡
        const targetId = this.getAttribute('data-target');
        const targetElement = document.getElementById(targetId);
        const icon = this.querySelector('i');
        
        if (targetElement.style.display === 'none') {
          targetElement.style.display = 'block';
          icon.classList.remove('fa-chevron-right');
          icon.classList.add('fa-chevron-down');
        } else {
          targetElement.style.display = 'none';
          icon.classList.remove('fa-chevron-down');
          icon.classList.add('fa-chevron-right');
        }
      });
    });
    
    // 展开/收起全部组织树
    document.getElementById('expand-all-tree-btn').addEventListener('click', function() {
      document.querySelectorAll('.tree-children').forEach(child => {
        child.style.display = 'block';
      });
      document.querySelectorAll('.tree-expand i').forEach(icon => {
        icon.classList.remove('fa-chevron-right');
        icon.classList.add('fa-chevron-down');
      });
    });
    
    document.getElementById('collapse-all-tree-btn').addEventListener('click', function() {
      document.querySelectorAll('.tree-children').forEach(child => {
        child.style.display = 'none';
      });
      document.querySelectorAll('.tree-expand i').forEach(icon => {
        icon.classList.remove('fa-chevron-down');
        icon.classList.add('fa-chevron-right');
      });
    });
    
    // 点击组织树节点切换选中状态
    document.querySelectorAll('.tree-content').forEach(content => {
      content.addEventListener('click', function() {
        // 移除其他节点的选中状态
        document.querySelectorAll('.tree-content').forEach(c => {
          c.classList.remove('org-tree-item-active');
        });
        
        // 添加当前节点的选中状态
        this.classList.add('org-tree-item-active');
        
        // 这里可以添加更新部门详情和成员列表的逻辑
        const deptName = this.querySelector('span').textContent;
        const deptIcon = this.querySelector('i').className;
        
        // 更新部门详情区域的部门名称
        document.querySelector('.text-xl.font-bold.text-text-primary').textContent = deptName;
        document.querySelector('.w-16.h-16.rounded-full.bg-primary-weak i').className = deptIcon;
        
        // 简单模拟不同部门的成员数量
        const memberCount = Math.floor(Math.random() * 20) + 5;
        document.querySelector('.text-primary.font-medium:nth-of-type(2)').textContent = memberCount;
        document.querySelector('.text-text-primary:nth-of-type(1)').textContent = `${memberCount}人`;
      });
    });
    
    // 新增部门弹窗
    const addDeptModal = document.getElementById('add-dept-modal');
    
    // 打开弹窗
    document.getElementById('add-dept-btn').addEventListener('click', function() {
      addDeptModal.classList.remove('hidden');
      // 防止背景滚动
      document.body.style.overflow = 'hidden';
    });
    
    // 关闭弹窗
    function closeDeptModal() {
      addDeptModal.classList.add('hidden');
      // 恢复背景滚动
      document.body.style.overflow = '';
    }
    
    document.getElementById('close-dept-modal-btn').addEventListener('click', closeDeptModal);
    document.getElementById('cancel-dept-btn').addEventListener('click', closeDeptModal);
    
    // 点击弹窗外部关闭
    addDeptModal.addEventListener('click', function(e) {
      if (e.target === addDeptModal) {
        closeDeptModal();
      }
    });
    
    // 提交表单
    document.getElementById('submit-dept-btn').addEventListener('click', function() {
      // 这里可以添加表单验证和提交逻辑
      alert('部门创建成功！');
      closeDeptModal();
    });
    
    // 编辑部门
    document.getElementById('edit-dept-btn').addEventListener('click', function() {
      // 可以复用新增部门弹窗，但需要填充当前部门数据
      addDeptModal.classList.remove('hidden');
      document.querySelector('#add-dept-modal h3').textContent = '编辑部门';
      // 防止背景滚动
      document.body.style.overflow = 'hidden';
    });
    
    // 删除部门
    document.getElementById('delete-dept-btn').addEventListener('click', function() {
      if (confirm('确定要删除这个部门吗？删除后将无法恢复，且部门下的成员将被转移到其他部门。')) {
        alert('部门删除成功！');
      }
    });
    
    // 添加成员
    document.getElementById('add-member-btn').addEventListener('click', function() {
      alert('添加成员功能待实现');
    });
    
    // 批量转移成员
    document.getElementById('batch-move-btn').addEventListener('click', function() {
      alert('批量转移成员功能待实现');
    });
    
    // 导入/导出部门
    document.getElementById('import-org-btn').addEventListener('click', function() {
      alert('导入部门功能待实现');
    });
    
    document.getElementById('export-org-btn').addEventListener('click', function() {
      alert('导出部门功能待实现');
    });
  </script>
</body>
</html>